{% extends 'base.html' %}

{% block title %}首页{% endblock %}

{% block headerjs %}

    <style>

        form {
            position: relative;
            width: 150px;
            margin: 0 auto;
        }

        .d1 {
            float: right;
            line-height: 67px;
        }

        .d1 input {
            width: 100px;
            height: 30px;
            border: 2px solid darkred;
            border-radius: 5px;
            outline: none;
            background: white;
            color: #1e242a;
        }
    </style>

{% endblock %}


{% block left %}
    <div id="main">
        {% for post in postlist %}
            <article class="article article-type-post">
                <div class="article-meta">
                    <a class="article-date">
                        <time>{{ post.created }}</time>
                    </a>
                    <div class="article-category">
                        <a class="article-category-link" href="#" target="_blank">{{ post.category.cname }}</a>
                    </div>
                </div>
                <div class="article-inner">
                    <header class="article-header">
                        <h1 itemprop="name">
                            <a class="article-title" href="#" target="_blank">{{ post.title }}</a>
                        </h1>
                    </header>
                    <div class="article-entry" itemprop="articleBody">
                        <h2>前言</h2>
                        <hr>
                        {{ post.desc }}


                        <p class="article-more-link">
                            <a href="/post/{{ post.id }}" target="_blank">阅读全文</a>
                        </p>
                    </div>
                    <footer class="article-footer">
                        <a data-url="存放文章的url" class="article-share-link">分享</a>
                        <ul class="article-tag-list">
                            {% for tag in post.tag.all %}

                                <li class="article-tag-list-item">
                                    <a class="article-tag-list-link" href="#">{{ tag.tname }}</a>
                                </li>
                            {% endfor %}
                        </ul>
                    </footer>
                </div>
            </article>
        {% endfor %}

        <nav id="page-nav">
            {% if postlist.has_previous %}
                <a class="extend prev" rel="next" href="/page/{{ postlist.previous_page_number }}">«Prev</a>
            {% endif %}
            {% for page in page_list %}
               {% if currentNum == page %}
                     <span class="page-number current">{{ page }}</span>
                {% else %}
                     <a class="page-number" href="/page/{{ page }}">{{ page }}</a>
                {% endif %}
            {% endfor %}

            {% if postlist.has_next %}
                <a class="extend next" rel="next" href="/page/{{ postlist.next_page_number }}">Next»</a>
            {% endif %}
        </nav>

    </div>

{% endblock %}
